package de.ihk_projekt.gui;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;

import de.ihk_projekt.start.Start;

import java.awt.SystemColor;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Die Klasse GUI erzeugt die Benutzerschnittstelle.
 * 
 * @author Merdin Pirildak
 */
public class GUI extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8900118731716655615L;
	private JPanel contentPane;

	/**
	 * Methode guiaufrufen ruft die Benutzerschnittstelle auf
	 */
	public static void guiaufrufen() {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					GUI frame = new GUI();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Erstellt ein frame.
	 * 
	 * @throws UnsupportedLookAndFeelException
	 * @throws IllegalAccessException
	 * @throws InstantiationException
	 * @throws ClassNotFoundException
	 */
	public GUI() throws ClassNotFoundException, InstantiationException,
			IllegalAccessException, UnsupportedLookAndFeelException {
		setForeground(SystemColor.activeCaption);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setTitle("Synchronisation von Kunden-Excel-Tabellen");
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		setBounds(100, 100, 313, 73);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);

		JButton btnBlacklist = new JButton("Filter starten");
		btnBlacklist.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Start.whiteListAusgeben();
			}
		});
		btnBlacklist.setBounds(9, 11, 190, 23);
		contentPane.add(btnBlacklist);

		JButton btnWhitelist = new JButton("Datenbank");
		btnWhitelist.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				Start.whiteListDatenbank();
			}
		});
		btnWhitelist.setBounds(208, 11, 89, 23);
		contentPane.add(btnWhitelist);

	}
}
